<!DOCTYPE html>
<html>
<head>
    <title>学校</title>
    <#include "/header.html">
    <style>
        .upload-list {
            display: inline-block;
            width: 60px;
            height: 60px;
            text-align: center;
            line-height: 60px;
            border: 1px solid transparent;
            border-radius: 4px;
            overflow: hidden;
            background: #fff;
            position: relative;
            box-shadow: 0 1px 1px rgba(0, 0, 0, .2);
            margin-right: 4px;
        }

        .upload-list img {
            width: 100%;
            height: 100%;
        }

        .upload-list-cover {
            display: none;
            position: absolute;
            top: 0;
            bottom: 0;
            left: 0;
            right: 0;
            background: rgba(0, 0, 0, .6);
        }

        .upload-list:hover .upload-list-cover {
            display: block;
        }

        .upload-list-cover i {
            color: #fff;
            font-size: 20px;
            cursor: pointer;
            margin: 0 2px;
        }
    </style>
</head>

<body>
<div id="rrapp" v-cloak>
    <div v-show="showList">
        <div class="grid-btn">
            <i-col span="4">
                <i-input v-model="q.name" @on-enter="query" placeholder="名称"/>
            </i-col>
            <i-button class="btn btn-primary" @click="query">查询</i-button>

            <i-button class="btn btn-warning" @click="queryEvaluate">查看评价</i-button>

            <div style="display: block;float: right">
			<#if shiro.hasPermission("lanling:school:save")>
            <a class="btn btn-primary" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</a>
			</#if>
			<#if shiro.hasPermission("lanling:school:update")>
            <a class="btn btn-primary" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</a>
			</#if>
			<#if shiro.hasPermission("lanling:school:delete")>
            <a class="btn btn-primary" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</a>
			</#if>
            </div>
        </div>
        <table id="jqGrid"></table>
        <div id="jqGridPager"></div>
    </div>

    <Card v-show="!showList" class="panel panel-default">
        <div class="panel-heading">{{title}}</div>
        <Tabs value="name1">
            <Tab-Pane label="通用信息" name="name1">

                <i-form ref="formValidate" :model="school" :rules="ruleValidate" :label-width="80"
                        class="form-horizontal">
                    <Form-item label="后台账号" prop="sysId">
                        <!--<i-input v-model="school.sysId" placeholder="后台账号"/>-->
                        <i-select v-model="school.sysId" filterable label-in-value>
                            <i-option v-for="backgroundAccount in backgroundAccounts" :value="backgroundAccount.userId"
                                      :key="backgroundAccount.userId">{{backgroundAccount.username}}
                            </i-option>
                        </i-select>
                    </Form-item>
                    <Form-item label="学校名称" prop="schoolName">
                        <i-input v-model="school.schoolName" placeholder="学校名称"/>
                    </Form-item>
                    <Form-item label="联系方式" prop="schoolPhone">
                        <i-input v-model="school.schoolPhone" placeholder="学校联系方式"/>
                    </Form-item>
                    <Form-item label="所在城市" prop="cityId">
                        <i-select v-model="school.cityId" filterable label-in-value @on-change="cityChange">
                            <i-option v-for="item in cityList" :value="item.id" :key="item.id">{{item.city}}</i-option>
                        </i-select>
                    </Form-item>
                    <Form-item label="学校logo" prop="schoolLogo">
                        <i-col span="16">
                            <i-input v-model="school.schoolLogo" placeholder="学校logo" readonly/>
                        </i-col>
                        <i-col span="3">
                            <Form-item :label-width="1">
                                <Upload style="width: 300px;" action="../../sys/oss/upload"
                                        :format="['jpg','jpeg','png']"
                                        max-size="2048"
                                        :on-success="handleSuccessPicUrl" :on-format-error="handleFormatError"
                                        :show-upload-list="false"
                                        :on-exceeded-size="handleMaxSize">
                                    <i-button icon="ios-cloud-upload-outline">上传图片</i-button>
                                </Upload>
                            </Form-item>
                        </i-col>
                        <i-col span="3">
                            <Form-item :label-width="1">
                                <i-button icon="eye" @click="eyeImagePicUrl">预览图片</i-button>
                            </Form-item>
                        </i-col>
                    </Form-item>
                    <Form-item label="获取经纬度">
                        <a href="http://www.gpsspg.com/maps.htm" target="_blank">在线地图经度纬度查询，请选择腾讯地图的经纬度，纬度范围:0-90.000000,经度范围:0-180.000000</a>
                    </Form-item>
                    <Form-item label="经度" prop="longitude">
                        <i-input v-model="school.longitude" placeholder="经度"/>
                    </Form-item>
                    <Form-item label="纬度" prop="latitude">
                        <i-input v-model="school.latitude" placeholder="纬度"/>
                    </Form-item>
                </i-form>
            </Tab-Pane>
            <Tab-Pane label="详细描述" name="name2">
                <template>
                    <div class="upload-list" v-for="item in uploadList">
                        <template v-if="item.status === 'finished'">
                            <img :src="item.picUrl"/>
                            <div class="upload-list-cover">
                                <Icon type="ios-eye-outline" @click.native="handleView(item.picUrl)"></Icon>
                                <Icon type="ios-trash-outline" @click.native="handleRemove(item)"></Icon>
                            </div>
                        </template>
                        <template v-else>
                            <Progress v-if="item.showProgress" :percent="item.percentage" hide-info></Progress>
                        </template>
                    </div>
                    <Upload
                            ref="upload"upload
                            :show-upload-list="false"
                            :default-file-list="uploadList"
                            :on-success="handleSuccess"
                            :format="['jpg','jpeg','png']"
                            :max-size="2048"
                            :on-format-error="handleFormatError"
                            :on-exceeded-size="handleMaxSize"
                            :before-upload="handleBeforeUpload"
                            multiple
                            type="drag"
                            action="../../sys/oss/upload"
                            style="display: inline-block;width:58px;">
                        <div style="width: 58px;height:58px;line-height: 58px;">
                            <Icon type="ios-camera" size="20"></Icon>
                        </div>
                    </Upload>
                    <Modal title="查看图片" v-model="visible">
                        <img :src="imgName" v-if="visible" style="width: 100%"/>
                    </Modal>
                </template>
                <div id="schoolDesc"></div>
            </Tab-Pane>
        </Tabs>
        <div style="padding-left: 20px">
            <i-button type="primary" @click="handleSubmit('formValidate')">提交</i-button>
            <i-button type="warning" @click="reload" style="margin-left: 8px"/>返回</i-button>
        </div>
    </Card>
    </div>
</div>

<script src="${request.contextPath}/statics/js/modules/lanling/school.js?_${.now?long}"></script>
</body>
</html>